/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lucky
 * Date: 2022-08-05
 * Time: 12:30
 */
public class demo1 {
    public static void main(String[] args) {
        String str = "aaaabbbcccdedeffg";
        System.out.println(str.indexOf('c'));
        System.out.println(str.indexOf("ab"));
        System.out.println(str.charAt(10));
        System.out.println(str.lastIndexOf('f'));
        System.out.println(str.lastIndexOf("de"));
        System.out.println(str.indexOf('b',6));
        System.out.println(str.indexOf("de",3));
        System.out.println(str.lastIndexOf('c',4));
        System.out.println(str.lastIndexOf("ab",5));
    }
    public static void main1(String[] args) {
        //第一种
//        String s1 = "xuexi";
       //第二种
        String s1 = new String("blue");
        String s3 = new String("blue");
        String s4 = new String("Blue");
        String s2 = s1;
        System.out.println(s3 == s1);
        System.out.println(s2 == s1);
        System.out.println(s3.equals(s1));
        System.out.println(s3.compareTo(s1));
        System.out.println(s4.compareToIgnoreCase(s4));

        //第三种
        char[] chars = {'a','b','c','d'};
//        String s3 = new String(chars);
//        System.out.println(s1.length());
//        System.out.println(s2.length());
//        System.out.println(s3.length());


    }
}
